using Cysharp.Threading.Tasks;
using NetProtocol.Enum;
using System;
using System.Collections.Generic;
using UnityEngine;

namespace IQIGame.Onigao.GamePlay
{
    public interface IGameplaySceneArea : IGameplayArea
    {
        /// <summary>
        /// 玩家当前地区cid
        /// </summary>
        int curRegionCid { get; }
        /// <summary>
        /// 是否已经进入该Area且场景已准备完毕可以开始游玩
        /// </summary>
        bool isSceneReady { get; }
        /// <summary>
        /// 导航控制器
        /// </summary>
        TNavigationController navigationCtrl { get; }
        /// <summary>
        /// 玩家化身实体
        /// </summary>
        /// <returns></returns>
        TViewEntity GetPlayerAvatarEntity();
        /// <summary>
        /// 根据模块配置id找到实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        TViewEntity GetEntityByMcid(int id);
        /// <summary>
        /// 根据实体id找到实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        TViewEntity GetEntityById(int id);
        /// <summary>
        /// 搜索实体
        /// </summary>
        /// <param name="result"></param>
        /// <param name="searchFunc"></param>
        void SearchEntities(List<TViewEntity> result, Func<TViewEntity, bool> searchFunc);
        /// <summary>
        /// 获取附近的实体
        /// </summary>
        /// <param name="entities">实体容器，传入时count == 0，方法调用完后，结果都存入该list</param>
        /// <param name="radius">半径，注意半径增大会影响性能</param>
        void GetEntitiesAround(List<TViewEntity> entities, float radius);
        /// <summary>
        /// 玩家是否在移动
        /// </summary>
        /// <returns></returns>
        bool IsPlayerMoving();
        /// <summary>
        /// 获取当前追踪的实体
        /// </summary>
        /// <returns></returns>
        TViewEntity GetTrackingEntity();
        /// <summary>
        /// 标记跟踪实体
        /// </summary>
        /// <param name="entityId"></param>
        UniTask MarkTrackingEntity(int entityId);
        /// <summary>
        /// 传送到其他地区
        /// 任务完成时，请求发送完毕，场景也切换完毕
        /// </summary>
        /// <param name="regionCid"></param>
        /// <param name="portalId"></param>
        /// <returns></returns>
        UniTask TeleportToRegion(int regionCid, int portalId);
        /// <summary>
        /// 切换位面（进入小游戏剧情啥的）
        /// </summary>
        /// <param name="phasing"></param>
        /// <param name="mainPhasingPos">回到主位面时的位置，0,0,0视为回到原位（也就是无法传送到0,0,0）</param>
        /// <returns></returns>
        UniTask<bool> SwitchPhasing(GameScenePhasing phasing, Vector3 mainPhasingPos = default);
        /// <summary>
        /// 修改时间（显示用，主要是修改天空盒等表现）
        /// </summary>
        /// <param name="hour24"></param>
        void ChangeDisplayTime(int hour24);
        /// <summary>
        /// 检查条件
        /// </summary>
        /// <param name="conditionCid"></param>
        /// <param name="interactingEntity"></param>
        /// <returns></returns>
        (bool, int) CheckCondition(int conditionCid, TViewEntity interactingEntity);
    }
}
